<template>
    <div class="tab-bar">
        <van-tabbar v-model="active" route>
          <van-tabbar-item
            v-for="route of tabNavs"
            :key="route.path"
            :icon="route.meta.icon"
            :to="route.path"
            :badge="route.meta.badge"
            >{{ route.meta.title }}
          </van-tabbar-item>
            <!-- <van-tabbar-item icon="wap-home-o" to="/home">首页</van-tabbar-item>
            <van-tabbar-item icon="apps-o" to="/list">列表页</van-tabbar-item>
            <van-tabbar-item icon="shopping-cart-o" to="/cart" badge="5">购物车</van-tabbar-item>
            <van-tabbar-item icon="user-o" to="/personal-center">我的</van-tabbar-item> -->
        </van-tabbar>
    </div>
</template>

<script>
import routes from '@/router/routes'
export default {
  name: 'Tabbar',
  data () {
    return {
      active: 1
    }
  },
  computed: {
    tabNavs () {
      return routes.filter(route => {
        return route.meta && route.meta.isTab
      })
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
